package com.feinno.urcs.group.api;

import com.feinno.urcs.group.entity.GroupTextMessageStorageEntity;
import com.feinno.urcs.profile.entity.ClientType;
import com.feinno.urcs.types.MobileNo;
import org.helium.framework.annotations.ServiceInterface;

import java.util.Collection;

/**
 * @author Li.Hongbo <lihongbo@feinno.com>
 *         用于群消息的存储，每一条给UE 的消息都通过此服务落地。
 */

@ServiceInterface(id = "group:GroupMessageStorageService")
public interface GroupMessageStorageService {
    /**
     * 保存群消息, 并返回本消息的id.
     *
     * @return
     */
    public long storageTextMessage(int groupId, MobileNo memberMobile, String contentType, byte[] content,ClientType clientType) throws Exception;

    /**
     * 从起始ID 开始,该群是否还有新的消息
     *
     * @param groupId
     * @param startOffset 起始ID, 不包含.
     * @return
     * @throws Exception
     */
    public boolean hasGroupMessage(int groupId, long startOffset) throws Exception;


    public Collection<GroupTextMessageStorageEntity> getTextMessage(int groupId, long groupMessageStorageId, int maxSize) throws Exception;
}
